package com.yosaa.back.enums;

public enum MalePullUpScore {
    EXCELLENT_100(100, 19, 20),
    EXCELLENT_95(95, 18, 19),
    EXCELLENT_90(90, 17, 18),
    GOOD_85(85, 16, 17),
    GOOD_80(80, 15, 16),
    PASS_76(76, 14, 15),
    PASS_72(72, 13, 14),
    PASS_68(68, 12, 13),
    PASS_64(64, 11, 12),
    PASS_60(60, 10, 11),
    FAIL_50(50, 9, 10),
    FAIL_40(40, 8, 9),
    FAIL_30(30, 7, 8),
    FAIL_20(20, 6, 7),
    FAIL_10(10, 5, 6);

    private final float score;
    private final float freshmanSophomore; // 大一大二标准
    private final float juniorSenior; // 大三大四标准

    MalePullUpScore(float score, float freshmanSophomore, float juniorSenior) {
        this.score = score;
        this.freshmanSophomore = freshmanSophomore;
        this.juniorSenior = juniorSenior;
    }

    public float getScore() {
        return score;
    }

    public float getFreshmanSophomore() {
        return freshmanSophomore;
    }

    public float getJuniorSenior() {
        return juniorSenior;
    }

    // 根据成绩和年级计算分数
    public static float calculateScore(float count, String grade) {
        for (MalePullUpScore standard : MalePullUpScore.values()) {
            float threshold = grade.equals("大一") || grade.equals("大二")
                    ? standard.getFreshmanSophomore()
                    : standard.getJuniorSenior();
            if (count >= threshold) {
                return standard.getScore();
            }
        }
        return 0; // 默认分数
    }
}